<template>
  
     <span class="glyphicon glyphicon-heart " aria-hidden="true"  :style="{color:colorFlag} " @click="changeColor" ></span>
 
</template>

<script>
import axios from "axios"
export default {
    name:"loveAdd",
    data(){
        return{
            colorFlag:"#666"
        }
    },
    props:{
        index:{
            type:String
        }
    },
    methods:{
         changeColor(value){
            this.colorFlag='red';
          let desObj= this.$store.state.desMessage.filter(value=>{
               return this.index===value._id
           })
       
          desObj[0].count+=1;
          axios.get("/blog/update?id="+desObj[0]._id).then(function(){
              console.log("OK")
          }).catch(err=>{
              console.log(err)
          })
          
          this.changeColor=function(){};
        }
    },
    mounted(){
      
    }
}
</script>

<style>

</style>